export default function barChart(data: any) {
  const options = {
    grid: {
      top: '18%',
      left: '8%',
      bottom: '10%',
      right: '5%',
      containLabel: true,
    },
    tooltip: {
      trigger: 'item',
      backgroundColor: 'rgba(3,50,86,0.8)',
      textStyle: {
        fontSize: 16,
        color: '#ffffff',
      },
    },
    xAxis: [
      {
        type: 'category',
        axisLine: {
          show: true,
          lineStyle: {
            color: 'rgba(171,170,170,0.2)',
          },
        },
        splitLine: {
          show: false,
        },
        axisLabel: {
          color: '#666666',
          margin: 20,
          rotate: 45,
          interval: 0,
        },
        axisTick: {
          show: false,
        },
        data: data.map((el: any) => el.cbdwmc || el.cbbmmc || el.cbjcg),
      },
    ],
    yAxis: {
      type: 'value',
      // name: '单位：人',
      // nameLocation: 'end',
      // nameTextStyle: {
      //   fontSize: 14,
      //   color: '#a6e4ff',
      //   align: 'right',
      // },
      axisLine: {
        show: false,
        lineStyle: {
          color: 'rgba(171,170,170,0.2)',
        },
      },
      splitLine: {
        show: true,
        lineStyle: {
          type: 'solid',
          color: 'rgba(171,170,170,0.2)',
        },
      },
      axisTick: {
        show: false,
      },
      axisLabel: {
        show: false,
        // interval: 0,
        // color: '#666666',
        // opacity: 0.6,
        // fontSize: 14,
      },
    },
    series: [
      {
        name: '数量',
        type: 'bar',
        zlevel: 1,
        itemStyle: {
          color: '#0090ff',
        },
        barMaxWidth: 55,
        data: data.map((el: any) => el.zs),
        label: {
          show: true,
          position: 'top',
          color: '#526a89', //柱状顶部文字颜色
          distance: 10,
          fontSize: 16,
          offset: [0, 2],
        },
      },
    ],
  }
  return options
}
